@extends('admin.main')

@section('content')
<div class="wrapper wrapper-content">
    <div class="m-b">
        <a href="javascript:;" class="btn btn-default" onclick="history.back();"><i class="fa fa-angle-double-left"></i> 返回列表</a>
    </div>
    <div class="ibox">
        <div class="ibox-title">
            <h5>新增设计师</h5>
        </div>
        <div class="ibox-content">
            <form id="formAdd" method="post" class="form-horizontal">
                <div class="form-group">
                    <label class="col-sm-2 control-label">姓名</label>
                    <div class="col-sm-5">
                        <input type="text" name="realname" class="form-control" required="" autofocus />
                    </div>
                    <div class="col-sm-5">
                        <label class="radio-inline i-checks">
                            <input type="radio" name="sex" value="男" checked="" />
                            男
                        </label>
                        <label class="radio-inline i-checks">
                            <input type="radio" name="sex" value="女" />
                            女
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">职位</label>
                    <div class="col-sm-2">
                        <select name="post" class="form-control">
                            @foreach($posts as $val)
                            <option value="{{$val}}">{{$val}}</option>
                            @endforeach
                        </select>
                    </div>
                    <label class="col-sm-1 control-label">工作经验</label>
                    <div class="col-sm-2">
                        <select name="experience" class="form-control">
                            @foreach($experiences as $val)
                            <option value="{{$val}}">{{$val}}</option>
                            @endforeach
                        </select>
                    </div>
                    <label class="col-sm-1 control-label">收费标准</label>
                    <div class="col-sm-2">
                        <select name="cost" class="form-control">
                            @foreach($costs as $val)
                            <option value="{{$val}}">{{$val}}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">擅长</label>
                    <div class="col-sm-10">
                        @foreach($styles as $val)
                        <label class="checkbox-inline i-checks">
                            <input type="checkbox" name="goodat[]" value="{{$val}}" />
                            {{$val}}
                        </label>
                        @endforeach
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">个人简介</label>
                    <div class="col-sm-10">
                        <textarea name="resume" class="form-control"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">主要作品</label>
                    <div class="col-sm-10">
                        <textarea name="works" class="form-control"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">设计理念</label>
                    <div class="col-sm-10">
                        <textarea name="idea" class="form-control"></textarea>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">人气指数</label>
                    <div class="col-sm-2">
                        <input type="text" name="fans" class="form-control" value="" />
                    </div>
                    <label class="col-sm-1 control-label">委托数量</label>
                    <div class="col-sm-2">
                        <input type="text" name="trusts" class="form-control" value="" />
                    </div>
                    <label class="col-sm-1 control-label">浏览次数</label>
                    <div class="col-sm-2">
                        <input type="text" name="views" class="form-control" value="" />
                    </div>
                    <div class="col-sm-2">
                        <label class="checkbox-inline i-checks">
                            <input type="checkbox" name="status" value="1" checked="" />
                            审核
                        </label>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2">
                        <button class="btn btn-warning btn-w-m" type="submit">提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
@endsection

@section('pageheader')
<link href="/assets/iCheck/custom.css" rel="stylesheet">
@endsection

@section('pagescript')
<script src="/assets/iCheck/icheck.min.js"></script>
<script>
    $("#side-menu li[rel='team']").addClass("active")
        .parents("ul").addClass("in").parents("li").addClass("active");

    $('.i-checks').iCheck({
        checkboxClass: 'icheckbox_square-green',
        radioClass: 'iradio_square-green',
    });

    $("#formAdd").on("submit", function(){
        this.status.value = this.status.checked ? 1 : 0;
        this.status.checked = true;
        var formdata = $(this).serialize();
        $.post("{{url('admin/team/designer-insert')}}", formdata, function(){
            window.location.href = document.referrer;
        }).fail(failure);
        return false;
    });
</script>
@endsection
